package com.atguigu.crowd.util;/*
 *ClassNmae:CrowdUtil
 *Package:com.atguigu.crowd.util
 *Description:
 *@Date:2020/6/15 10:44
 *@Author:1519524541@qq.com
 */
//判断当前请求是否为AJax请求
import javax.servlet.http.HttpServletRequest;

public class CrowdUtil {
    public static boolean judgeRequestType(HttpServletRequest request){
        String acceptHeader = request.getHeader("Accept");
        String xRequestHeader = request.getHeader("X-Requested-With");
return (acceptHeader!=null&& acceptHeader.contains("application/json"))
        ||
        (xRequestHeader!=null && xRequestHeader.equals("XMLHttpRequest"));


    }
}
